<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form"%>

<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->

<head>
<jsp:include page="../../views/include/header.jsp" />
<script type="text/javascript">
function cancelReg(regid){
	$('#id').val(regid);
	clicksubmit('_eventId_cancel');
}
function confirmReg(regid){
	$('#id').val(regid);
	clicksubmit('_eventId_confirm');
}
</script> 
</head>
<body>
<sf:form method="post" modelAttribute="registerFilter">
	<input type="submit" name="_eventId_participant" value="Participant Report"/>
	<input type="submit" name="_eventId_excel" value="Save as Excel"/>
	<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}" />
	<sf:hidden path="id"/>
	<div style="display: none;">
		<input type="submit" name="_eventId_cancel" value="cancel"/>
		<input type="submit" name="_eventId_confirm" value="confirm"/>
	</div>
<h2>Registration Report</h2>
<table border="1"><tbody>
<tr>
	<th>Id</th>
	<th>Register Date</th>
	<th>Updated Date</th>
	<th>Pledger?</th>
	<th>Company</th>
	<th>Company Address</th>
	<th>Update Address?</th>
	<th>Salutation</th>
	<th>First Name</th>
	<th>Last Name</th>
	<th>Designation</th>
	<th>Contact No</th>
	<th>Email</th>
	<th>Receive Update?</th>
	<th>SNEF Member</th>
	<th>SNEF Member Id</th>
	<th>Amount</th>
	<th>Paypal payment status</th>
	<th>Paypal payer</th>
	<th>Cheque Name</th>
	<th>Cheque Contact</th>
	<th>Cheque Email</th>
	<th>Cheque Address</th>
	<th>Cheque Sub-BU</th>
	<th>Status</th>
	<th></th>
</tr>
<c:forEach items="${registerList}" var="r" varStatus="rStatus">
<tr>
	<td><c:out value="${r.id}"/></td>
	<td><fmt:formatDate value="${r.createdDate}" type="both"/></td>
	<td><fmt:formatDate value="${r.updatedDate}" type="both"/></td>
	<td><c:out value="${r.pledger}"/></td>
	<td><c:out value="${r.companyName}${r.companyNameOther}"/></td>
	<td><c:out value="${r.companyAddress}"/></td>
	<td><c:out value="${r.updateAddress}"/></td>
	<td><c:out value="${r.salutation}"/></td>
	<td><c:out value="${r.firstName}"/></td>
	<td><c:out value="${r.lastName}"/></td>
	<td><c:out value="${r.designation}"/></td>
	<td><c:out value="${r.telephone}"/></td>
	<td><c:out value="${r.email}"/></td>
	<td><c:out value="${r.receiveUpdate}"/></td>
	<td><c:out value="${r.snefMember}"/></td>
	<td><c:out value="${r.snefId}"/></td>
	<td><fmt:formatNumber type="currency" value="${r.amount}" currencySymbol="S$"/></td>
	<td><c:out value="${r.paymentStatus eq 1?'Success':''}"/></td>
	<td><c:out value="${r.payerEmail}"/></td>
	<td><c:out value="${r.chequeContact.name}"/></td>
	<td><c:out value="${r.chequeContact.contact}"/></td>
	<td><c:out value="${r.chequeContact.email}"/></td>
	<td><c:out value="${r.chequeContact.address}"/></td>
	<td><c:out value="${r.chequeContact.subBu}"/></td>
	<td>
		<c:choose>
			<c:when test="${r.status eq 0}">Pending</c:when>
			<c:when test="${r.status eq 1}">Confirmed</c:when>
			<c:when test="${r.status eq 2}">Cancelled</c:when>
			<c:otherwise>${r.status}</c:otherwise>
		</c:choose>
	</td>
	<td>
		<c:if test="${r.status eq 0 and r.participantSize gt 0}">
			<input type="button" value="Cancel and Release Seat" onclick="javascript:cancelReg(${r.id});"/>
			<input type="button" value="Confirm and Send Email" onclick="javascript:confirmReg(${r.id});"/>
		</c:if>
	</td>
</tr>
</c:forEach>
</tbody></table>
</sf:form>
</body></html>